<?php
namespace Application\Repository;
use Doctrine\ORM\EntityRepository;

class LocationRepository extends AbstractRepository
{
     protected  $entity="Application\\Entity\\Location";
    
    public function getByParent($parentId,$number = 1000)
    {
        $dql = "SELECT c FROM $this->entity c WHERE IDENTITY(c.parent)=?1";

        return $this->getEntityManager()->createQuery($dql)
                             ->setParameter(1, $parentId)
                             ->setMaxResults($number)
                             ->getResult();
    }
}